package com.lh.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: LuoHang
 * @Date: 2023/2/20 20:58
 * @Description
 */
@Configuration
@EnableWebMvc
public class FileConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        /*
         * #虚拟路径配置
         * ###静态资源对外暴露的访问路径
         * staticAccessPath=/upload/file/**
         * ###静态资源实际存储路径---路径最后一定要加反斜杠“/”,不然映射不成功***注意****已踩坑2小时 Fuck
         * uploadFolder=D:/java code/static/images/
         */
        registry.addResourceHandler("/upload/file/**").addResourceLocations("file:D:/java code/static/images/");
    }
}
